package com.security.security;


import com.security.dao.UserDao;
import com.security.dto.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 顾志杰
 * @date 2020/7/20-13:51
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class UserDetailsServiceImpl implements UserDetailsService {

    @Autowired
    private UserDao userDao;

    @Override
    public SysUser loadUserByUsername(String username) throws UsernameNotFoundException {
        return userDao.findByUserName(username);
    }
}
